{include file="public/layout" /}
<body class="bodystyle" style="overflow-y: scroll;min-width:auto;">
<div id="toolTipLayer" style="position: absolute; z-index: 9999; display: none; visibility: visible; left: 95px; top: 573px;"></div>
<div id="append_parent"></div>
<div id="ajaxwaitid"></div>
<div class="page min-hg-c-10">
    {include file="language/bar" /}
    <!-- 操作说明 -->
    <div id="" class="explanation">
        <ul>
            <li>语言分离关闭时，其它语言数据将会和主语言数据同步，其它语言数据不可单独操作，只能对主语言数据进行操作。</li>
            <li>语言分离开启时，数据不再同步，这些模块可以单独操作（栏目、文档，广告、友情链接、留言表单等），模板栏目变量将自动隐藏并失效。</li>
        </ul>
    </div>
    <form class="form-horizontal" id="post_form" action="{:url('Language/conf')}" method="post">
        <div class="ncap-form-default">
            <dl class="row">
                <dt class="tit">
                    <label>语言分离</label>
                </dt>
                <dd class="opt" style="width: auto;">
                    <label class="curpoin"><input type="radio" id="language_split_1" name="language[language_split]" value="1" {notempty name="$global['language_split']"} checked="checked" {/notempty}/>开启</label>&nbsp;&nbsp;
                    <label class="curpoin"><input type="radio" id="language_split_0" name="language[language_split]" value="0" {empty name="$global['language_split']"} checked="checked" {/empty}/>关闭</label>&nbsp;&nbsp;
                    <p class="notic">开启后，数据不再同步，这些模块可以单独操作（栏目、文档内容，广告、友情链接、留言表单等）</p>
                    <input type="hidden" id="language_split_old" value="{$global['language_split']|default=0}">
                </dd>
            </dl>
            {eq name="'Language@customvar_arctype'|is_check_access" value="1"}
                {if condition="empty($global['language_split'])"}
                <dl class="row">
                    <dt class="tit">
                        <label>模板栏目变量</label>
                    </dt>
                    <dd class="opt" style="width: auto;">
                        <a href="javascript:void(0);" data-href="{:url('Language/customvar_arctype')}" class="ncap-btn ncap-btn-green" onclick="openFullframe(this, '模板栏目变量', '90%', '90%');">管理</a>
                        <span class="err"></span>
                        <p class="notic"></p>
                    </dd>
                </dl>
                {/if}
            {/eq}
            {eq name="'Language@pack_index'|is_check_access" value="1"}
            <dl class="row">
                <dt class="tit">
                    <label>模板语言变量</label>
                </dt>
                <dd class="opt" style="width: auto;">
                    <a href="javascript:void(0);" data-href="{:url('Language/pack_index')}" class="ncap-btn ncap-btn-green" onclick="openFullframe(this, '模板语言变量', '90%', '90%');">管理</a>
                    <span class="err"></span>
                    <p class="notic"></p>
                </dd>
            </dl>
            {/eq}
            {eq name="'Language@official_pack_index'|is_check_access" value="1"}
            <dl class="row">
                <dt class="tit">
                    <label>官方语言包变量</label>
                </dt>
                <dd class="opt" style="width: auto;">
                    <a href="javascript:void(0);" data-href="{:url('Language/official_pack_index')}" class="ncap-btn ncap-btn-green" onclick="openFullframe(this, '官方语言包变量', '90%', '90%');">管理</a>
                    <span class="err"></span>
                    <p class="notic"></p>
                </dd>
            </dl>
            {/eq}
        </div>
    </form>
</div>
<script type="text/javascript">
    $(function(){
        $('input[name="language[language_split]"]').click(function(){
            var language_split = $(this).val();
            var title = '开启语言分离后，栏目等数据将不再同步，如有执行栏目的增删改，将不能切换回关闭状态，否则会报错；<br/>有修改，如需要切换回关闭状态，建议删除语言包并重新创建。';
            layer.confirm(title, {
                shade: layer_shade,
                area: ['480px', '220px'],
                move: false,
                title: '提示',
                btnAlign:'r',
                closeBtn: 3,
                btn: ['确定', '取消'] ,//按钮
                success: function () {
                    $(".layui-layer-content").css('text-align', 'left');
                }
            }, function (index, layero) {
                layer_loading('正在保存');
                $.ajax({
                    type : 'post',
                    url : "{:url('Language/conf', ['_ajax'=>1])}",
                    data : $('#post_form').serialize(),
                    dataType : 'json',
                    success : function(res){
                        layer.closeAll();
                        if(res.code == 1){
                            layer.msg(res.msg, {shade: layer_shade, time: 1000}, function(){
                                window.location.reload();
                            });
                        }else{
                            showErrorMsg(res.msg);
                        }
                    },
                    error: function(e){
                        layer.closeAll();
                        showErrorAlert(e.responseText);
                    }
                });
            }, function (index) {
                $('#language_split_'+$('#language_split_old').val()).prop('checked',true);
                layer.close(index);
            });
        });
    });
</script>
{include file="public/footer" /}